export default class extends think.Model {
  get pk() {
    return "member_id";
  }
  getList() {
    return this.field("name").select();
  }
  getInfo(memberId:number){
        
  }
  async addWechatUser(chatinfo: any) {
    const result = await this.transaction(async () => {
      chatinfo.create_time = think.formatter();
      const insertId = await this.add(chatinfo);
      console.log(insertId);
      const $MemberWechatModel = this.model("member_wechat").db(this.db());
      let member_wechat_id = await $MemberWechatModel.add({
        member_id: insertId,
        ...chatinfo,
      });
      const results = await this.where({ [this.pk]: insertId }).update({
        member_wechat_id: member_wechat_id,
      });
      console.log(results);
      return results
    });
  }
}
